package com.soyoung.service.impl;

import com.soyoung.entity.User;
import com.soyoung.entity.UserExample;
import com.soyoung.mapper.UserMapper;
import com.soyoung.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author : zhq
 * @since : 2018/5/2
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public List<User> getlist() {
        UserExample example = new  UserExample();
        example.setOrderByClause("create_time desc");
        List<User> list = userMapper.selectByExample(example);
        return list;
    }

    @Override
    public User selectByPrimaryKey(Integer id) {
        User u = userMapper.selectByPrimaryKey(id);
        return u;
    }
}
